// $_FILEHEADER_BEGIN ***************************
// 版权声明:Timer
// Copyright © 2015 - Timer All Rights Reserved
// 文件名称: ARFriendCell.m
// 创建日期: 15/12/13
// 创 建 人: 甄鑫
// 文件说明: <#content#>
// $_FILEHEADER_END ******************************


#import "ARFriendCell.h"
#import <UIImageView+WebCache.h>
#import "NavHelper.h"
@implementation ARFriendCell

- (void)awakeFromNib {
    // Initialization code
    self.levelLabel.layer.borderColor = [UIColor redColor].CGColor;
    self.isBorrowLabel.layer.borderColor = [UIColor redColor].CGColor;
    self.levelLabel.layer.borderWidth = 0.5;
    self.isBorrowLabel.layer.borderWidth = 0.5;
    self.levelLabel.layer.cornerRadius = 3;
    self.isBorrowLabel.layer.cornerRadius = 3;
    self.muchBorrow.layer.cornerRadius = 3;
    self.muchBorrow.layer.borderWidth = 0.5;
    self.muchBorrow.layer.borderColor = [UIColor redColor].CGColor;
}
- (void)layoutSubviews{
    [super layoutSubviews];
    self.headerImage.layer.cornerRadius = self.headerImage.frame.size.height/2.0;
    self.headerImage.clipsToBounds = YES;
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

- (void)setData:(id)data
{
    ARCellModel *model = (ARCellModel *)data;
    [self.headerImage sd_setImageWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@%@",HEADERIMAGE_FETCH,[model.data localid]]]];
    self.userid = [model.data localid];
    self.nickNameLabel.text = [model.data fullname];
    BOOL isBorrow = [[model.data isborrow] boolValue];
    if (isBorrow) {
        self.muchBorrow.hidden = NO;
    }else{
        self.muchBorrow.hidden = YES;
    }
    NSInteger level = [[model.data fetchLevel] integerValue];
    if (level == 1) {
        self.levelLabel.text = @" 朋友     ";
    }else{
        self.levelLabel.text = @" 朋友的朋友     ";
    }
    self.isBorrowLabel.text = [NSString stringWithFormat:@" %@人已借     ",[model.data fetchInvestcount]];
    
    switch (model.parentVCType) {
            case 1:case 0:case 11:case 12://借款中
        {
            if([[model.data remainhour] integerValue]==0){
                self.timeLabel.text = [NSString stringWithFormat:@"剩余%@分钟",[model.data remainminute]];
            }else{
                self.timeLabel.text = [NSString stringWithFormat:@"剩余%@小时",[model.data remainhour]];
            }
            if ([[model.data remainhour] integerValue]<0) {
                self.timeLabel.text = @"已超时";
            }
        }
            break;
            
        default:
        {
            self.timeLabel.hidden = YES;
        }
            break;
    }
    
}
- (IBAction)headerImageBtnClick:(id)sender {
    
    [NavHelper gotoContactDetailVCWithUserId:self.userid];
    
}
- (void)reSet
{
    
}
- (id)getData
{
    return nil;
}
- (void)setDelegate:(id)delegate
{
    
}


@end
